It seems the reason for this is that, before SSDs, and before even hard disk drives, data was stored in tapes. Tapes were the medium where the data was stored. And to read and write data on these tapes, you would have to roll and unroll them. The device that spun them was the tape drive. So this is the actual physical drive from which all computer drives derive their name.
Nowadays we also have online "drives" such as Google Drive and Microsoft OneDrive that are personal cloud storage services. They let you save your files to the "cloud," i.e. to their computers. It's likely their names stem from the fact that "drive" is a generic term for device you can save your files to. Interestingly, a similar term, "disk," doesn't enjoy the same semantic bleaching, since we still divide "save to disk" from "save to cloud." See also [Why is the "Disk" Called "Disk" if it isn't a Disk?].

Originally, the drive was not the storage device. It was the mechanism that you mounted the storage device onto.¹ Spools of tape were mounted on the motor spindle of a tape drive, and disk packs and floppy disks were mounted on the motor spindle of a disk drive. The drive imparted to them a spinning motion:
[Images of tape drives.]
https://english.stackexchange.com/questions/335105/etymology-of-the-use-of-drive-to-refer-to-a-digital-storage-medium (accessed 2025-01-15)
- Drive in this original sense is attested in American English by Collins English Dictionary:
- Drive, American English sense 28, “a device that communicates motion to a machine or machine part”. (Collins)
- See also the example in American English sense 27a, “any apparatus that transmits power in a motor vehicle: a gear drive”. (op. cit.)